In [1]:
%matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
from IPython.display import Image

Nansat: generic way to open many input datasets


In [2]:
# open MERIS L1 data
from nansat import Nansat
n1 = Nansat('/files/normap/MER_FRS_1PNUPA20110908_092035_000005513106_00223_49806_1826.N1')
print n1


----------------------------------------
/files/normap/MER_FRS_1PNUPA20110908_092035_000005513106_00223_49806_1826.N1
----------------------------------------
Mapper: meris_l1
----------------------------------------
Band : 1 L_413
  units: mW m-2 sr-1 (cm-1)-1
  colormap: jet
  short_name: L
  dataType: 6
  long_name: top of atmosphere emitted toward outer space per unit wavenumber or as a function of wavenumber radiative flux in a particular direction, per unit of solid angle
  standard_name: toa_outgoing_spectral_radiance
  wavelength: 413
  suffix: 413
  SourceFilename: /files/normap/MER_FRS_1PNUPA20110908_092035_000005513106_00223_49806_1826.N1
  time: 2011-09-08T09:20:35.962775
  minmax: 0.000 1000
  SourceBand: 1
  wkv: toa_outgoing_spectral_radiance
  name: L_413
Band : 2 L_443
  units: mW m-2 sr-1 (cm-1)-1
  colormap: jet
  short_name: L
  dataType: 6
  long_name: top of atmosphere emitted toward outer space per unit wavenumber or as a function of wavenumber radiative flux in a particular direction, per unit of solid angle
  standard_name: toa_outgoing_spectral_radiance
  wavelength: 443
  suffix: 443
  SourceFilename: /files/normap/MER_FRS_1PNUPA20110908_092035_000005513106_00223_49806_1826.N1
  time: 2011-09-08T09:20:35.962775
  minmax: 0.000 1000
  SourceBand: 2
  wkv: toa_outgoing_spectral_radiance
  name: L_443
Band : 3 L_490
  units: mW m-2 sr-1 (cm-1)-1
  colormap: jet
  short_name: L
  dataType: 6
  long_name: top of atmosphere emitted toward outer space per unit wavenumber or as a function of wavenumber radiative flux in a particular direction, per unit of solid angle
  standard_name: toa_outgoing_spectral_radiance
  wavelength: 490
  suffix: 490
  SourceFilename: /files/normap/MER_FRS_1PNUPA20110908_092035_000005513106_00223_49806_1826.N1
  time: 2011-09-08T09:20:35.962775
  minmax: 0.000 1000
  SourceBand: 3
  wkv: toa_outgoing_spectral_radiance
  name: L_490
Band : 4 L_510
  units: mW m-2 sr-1 (cm-1)-1
  colormap: jet
  short_name: L
  dataType: 6
  long_name: top of atmosphere emitted toward outer space per unit wavenumber or as a function of wavenumber radiative flux in a particular direction, per unit of solid angle
  standard_name: toa_outgoing_spectral_radiance
  wavelength: 510
  suffix: 510
  SourceFilename: /files/normap/MER_FRS_1PNUPA20110908_092035_000005513106_00223_49806_1826.N1
  time: 2011-09-08T09:20:35.962775
  minmax: 0.000 1000
  SourceBand: 4
  wkv: toa_outgoing_spectral_radiance
  name: L_510
Band : 5 L_560
  units: mW m-2 sr-1 (cm-1)-1
  colormap: jet
  short_name: L
  dataType: 6
  long_name: top of atmosphere emitted toward outer space per unit wavenumber or as a function of wavenumber radiative flux in a particular direction, per unit of solid angle
  standard_name: toa_outgoing_spectral_radiance
  wavelength: 560
  suffix: 560
  SourceFilename: /files/normap/MER_FRS_1PNUPA20110908_092035_000005513106_00223_49806_1826.N1
  time: 2011-09-08T09:20:35.962775
  minmax: 0.000 1000
  SourceBand: 5
  wkv: toa_outgoing_spectral_radiance
  name: L_560
Band : 6 L_620
  units: mW m-2 sr-1 (cm-1)-1
  colormap: jet
  short_name: L
  dataType: 6
  long_name: top of atmosphere emitted toward outer space per unit wavenumber or as a function of wavenumber radiative flux in a particular direction, per unit of solid angle
  standard_name: toa_outgoing_spectral_radiance
  wavelength: 620
  suffix: 620
  SourceFilename: /files/normap/MER_FRS_1PNUPA20110908_092035_000005513106_00223_49806_1826.N1
  time: 2011-09-08T09:20:35.962775
  minmax: 0.000 1000
  SourceBand: 6
  wkv: toa_outgoing_spectral_radiance
  name: L_620
Band : 7 L_665
  units: mW m-2 sr-1 (cm-1)-1
  colormap: jet
  short_name: L
  dataType: 6
  long_name: top of atmosphere emitted toward outer space per unit wavenumber or as a function of wavenumber radiative flux in a particular direction, per unit of solid angle
  standard_name: toa_outgoing_spectral_radiance
  wavelength: 665
  suffix: 665
  SourceFilename: /files/normap/MER_FRS_1PNUPA20110908_092035_000005513106_00223_49806_1826.N1
  time: 2011-09-08T09:20:35.962775
  minmax: 0.000 1000
  SourceBand: 7
  wkv: toa_outgoing_spectral_radiance
  name: L_665
Band : 8 L_681
  units: mW m-2 sr-1 (cm-1)-1
  colormap: jet
  short_name: L
  dataType: 6
  long_name: top of atmosphere emitted toward outer space per unit wavenumber or as a function of wavenumber radiative flux in a particular direction, per unit of solid angle
  standard_name: toa_outgoing_spectral_radiance
  wavelength: 681
  suffix: 681
  SourceFilename: /files/normap/MER_FRS_1PNUPA20110908_092035_000005513106_00223_49806_1826.N1
  time: 2011-09-08T09:20:35.962775
  minmax: 0.000 1000
  SourceBand: 8
  wkv: toa_outgoing_spectral_radiance
  name: L_681
Band : 9 L_709
  units: mW m-2 sr-1 (cm-1)-1
  colormap: jet
  short_name: L
  dataType: 6
  long_name: top of atmosphere emitted toward outer space per unit wavenumber or as a function of wavenumber radiative flux in a particular direction, per unit of solid angle
  standard_name: toa_outgoing_spectral_radiance
  wavelength: 709
  suffix: 709
  SourceFilename: /files/normap/MER_FRS_1PNUPA20110908_092035_000005513106_00223_49806_1826.N1
  time: 2011-09-08T09:20:35.962775
  minmax: 0.000 1000
  SourceBand: 9
  wkv: toa_outgoing_spectral_radiance
  name: L_709
Band : 10 L_753
  units: mW m-2 sr-1 (cm-1)-1
  colormap: jet
  short_name: L
  dataType: 6
  long_name: top of atmosphere emitted toward outer space per unit wavenumber or as a function of wavenumber radiative flux in a particular direction, per unit of solid angle
  standard_name: toa_outgoing_spectral_radiance
  wavelength: 753
  suffix: 753
  SourceFilename: /files/normap/MER_FRS_1PNUPA20110908_092035_000005513106_00223_49806_1826.N1
  time: 2011-09-08T09:20:35.962775
  minmax: 0.000 1000
  SourceBand: 10
  wkv: toa_outgoing_spectral_radiance
  name: L_753
Band : 11 L_761
  units: mW m-2 sr-1 (cm-1)-1
  colormap: jet
  short_name: L
  dataType: 6
  long_name: top of atmosphere emitted toward outer space per unit wavenumber or as a function of wavenumber radiative flux in a particular direction, per unit of solid angle
  standard_name: toa_outgoing_spectral_radiance
  wavelength: 761
  suffix: 761
  SourceFilename: /files/normap/MER_FRS_1PNUPA20110908_092035_000005513106_00223_49806_1826.N1
  time: 2011-09-08T09:20:35.962775
  minmax: 0.000 1000
  SourceBand: 11
  wkv: toa_outgoing_spectral_radiance
  name: L_761
Band : 12 L_778
  units: mW m-2 sr-1 (cm-1)-1
  colormap: jet
  short_name: L
  dataType: 6
  long_name: top of atmosphere emitted toward outer space per unit wavenumber or as a function of wavenumber radiative flux in a particular direction, per unit of solid angle
  standard_name: toa_outgoing_spectral_radiance
  wavelength: 778
  suffix: 778
  SourceFilename: /files/normap/MER_FRS_1PNUPA20110908_092035_000005513106_00223_49806_1826.N1
  time: 2011-09-08T09:20:35.962775
  minmax: 0.000 1000
  SourceBand: 12
  wkv: toa_outgoing_spectral_radiance
  name: L_778
Band : 13 L_864
  units: mW m-2 sr-1 (cm-1)-1
  colormap: jet
  short_name: L
  dataType: 6
  long_name: top of atmosphere emitted toward outer space per unit wavenumber or as a function of wavenumber radiative flux in a particular direction, per unit of solid angle
  standard_name: toa_outgoing_spectral_radiance
  wavelength: 864
  suffix: 864
  SourceFilename: /files/normap/MER_FRS_1PNUPA20110908_092035_000005513106_00223_49806_1826.N1
  time: 2011-09-08T09:20:35.962775
  minmax: 0.000 1000
  SourceBand: 13
  wkv: toa_outgoing_spectral_radiance
  name: L_864
Band : 14 L_849
  units: mW m-2 sr-1 (cm-1)-1
  colormap: jet
  short_name: L
  dataType: 6
  long_name: top of atmosphere emitted toward outer space per unit wavenumber or as a function of wavenumber radiative flux in a particular direction, per unit of solid angle
  standard_name: toa_outgoing_spectral_radiance
  wavelength: 849
  suffix: 849
  SourceFilename: /files/normap/MER_FRS_1PNUPA20110908_092035_000005513106_00223_49806_1826.N1
  time: 2011-09-08T09:20:35.962775
  minmax: 0.000 1000
  SourceBand: 14
  wkv: toa_outgoing_spectral_radiance
  name: L_849
Band : 15 L_900
  units: mW m-2 sr-1 (cm-1)-1
  colormap: jet
  short_name: L
  dataType: 6
  long_name: top of atmosphere emitted toward outer space per unit wavenumber or as a function of wavenumber radiative flux in a particular direction, per unit of solid angle
  standard_name: toa_outgoing_spectral_radiance
  wavelength: 900
  suffix: 900
  SourceFilename: /files/normap/MER_FRS_1PNUPA20110908_092035_000005513106_00223_49806_1826.N1
  time: 2011-09-08T09:20:35.962775
  minmax: 0.000 1000
  SourceBand: 15
  wkv: toa_outgoing_spectral_radiance
  name: L_900
Band : 16 flags_l1
  units: 1
  colormap: jet
  short_name: flags
  dataType: 1
  long_name: Quality Flags
  standard_name: quality_flags
  suffix: l1
  SourceFilename: /files/normap/MER_FRS_1PNUPA20110908_092035_000005513106_00223_49806_1826.N1
  time: 2011-09-08T09:20:35.962775
  minmax: 0 1
  SourceBand: 16
  wkv: quality_flags
  name: flags_l1
Band : 17 sun zenith angles
  name: sun zenith angles
  dataType: 7
  units: (10)^-6 deg
  SourceFilename: /vsimem/QOJWF5B0IY.vrt
  time: 2011-09-08T09:20:35.962775
  SourceBand: 1
Band : 18 sun azimuth angles
  name: sun azimuth angles
  dataType: 7
  units: (10)^-6 deg
  SourceFilename: /vsimem/7BS5AY3ZYB.vrt
  time: 2011-09-08T09:20:35.962775
  SourceBand: 1
Band : 19 zonal winds
  name: zonal winds
  dataType: 7
  units: m*s-1
  SourceFilename: /vsimem/DJJ6PTL5Y4.vrt
  time: 2011-09-08T09:20:35.962775
  SourceBand: 1
Band : 20 meridional winds
  name: meridional winds
  dataType: 7
  units: m*s-1
  SourceFilename: /vsimem/GGRWURV4UE.vrt
  time: 2011-09-08T09:20:35.962775
  SourceBand: 1
----------------------------------------
Domain:[4481 x 12545]
----------------------------------------
Projection:
GEOGCS["WGS 84",
    DATUM["WGS_1984",
        SPHEROID["WGS 84",6378137,298.257223563],
        TOWGS84[0,0,0,0,0,0,0]],
    PRIMEM["Greenwich",0],
    UNIT["degree",0.0174532925199433]]
----------------------------------------
Corners (lon, lat):
	 ( 96.69,  77.48)  ( 60.84,  86.22)
	 ( 31.75,  52.68)  ( 14.24,  54.59)


In [3]:
# open ASAR L1 data
n2 = Nansat('/files/normap/ASA_WSM_1PNPDK20060404_091239_000000852046_00308_21404_2157.N1')
print n2


----------------------------------------
/files/normap/ASA_WSM_1PNPDK20060404_091239_000000852046_00308_21404_2157.N1
----------------------------------------
Mapper: asar
----------------------------------------
Band : 1 raw_counts_VV
  dataType: 2
  SourceBand: 1
  name: raw_counts_VV
  SourceFilename: /files/normap/ASA_WSM_1PNPDK20060404_091239_000000852046_00308_21404_2157.N1
  time: 2006-04-04T09:12:39.182173
Band : 2 incidence_angle
  units: degrees
  colormap: jet
  short_name: incidence_angle
  dataType: 7
  long_name: Incidence Angle
  standard_name: angle_of_incidence
  SourceFilename: /vsimem/RLTVIUGSYI.vrt
  time: 2006-04-04T09:12:39.182173
  minmax: 0 90
  SourceBand: 1
  wkv: angle_of_incidence
  name: incidence_angle
Band : 3 SAR_look_direction
  units: degrees
  colormap: jet
  short_name: sat_azimuth
  dataType: 6
  long_name: Sensor Azimuth Angle
  standard_name: sensor_azimuth_angle
  SourceFilename: /vsimem/0J7XFZH3QU.vrt
  time: 2006-04-04T09:12:39.182173
  minmax: 0 360
  SourceBand: 1
  wkv: sensor_azimuth_angle
  name: SAR_look_direction
Band : 4 sigma0_VV
  units: m/m
  colormap: gray
  short_name: sigma0
  dataType: 6
  PixelFunctionType: RawcountsIncidenceToSigma0
  time: 2006-04-04T09:12:39.182173
  polarization: VV
  long_name: Normalized Radar Cross Section
  standard_name: surface_backwards_scattering_coefficient_of_radar_wave
  suffix: VV
  SourceFilename: /files/normap/ASA_WSM_1PNPDK20060404_091239_000000852046_00308_21404_2157.N1
  pass: DESCENDING
  minmax: 0 0.1
  SourceBand: 1
  wkv: surface_backwards_scattering_coefficient_of_radar_wave
  name: sigma0_VV
Band : 5 sigma0_ice_VV
  units: m/m
  colormap: gray
  short_name: sigma0_normalized_ice
  dataType: 6
  PixelFunctionType: Sigma0NormalizedIce
  time: 2006-04-04T09:12:39.182173
  polarization: VV
  long_name: Normalized Radar Cross Section - normalized over ice
  standard_name: surface_backwards_scattering_coefficient_of_radar_wave_normalized_over_ice
  suffix: VV
  SourceFilename: /files/normap/ASA_WSM_1PNPDK20060404_091239_000000852046_00308_21404_2157.N1
  pass: 
  minmax: 0 0.1
  SourceBand: 1
  wkv: surface_backwards_scattering_coefficient_of_radar_wave_normalized_over_ice
  name: sigma0_ice_VV
Band : 6 sigma0_water_VV
  units: m/m
  colormap: gray
  short_name: sigma0_normalized_water
  dataType: 6
  PixelFunctionType: Sigma0VVNormalizedWater
  time: 2006-04-04T09:12:39.182173
  polarization: VV
  long_name: Normalized Radar Cross Section - normalized over water
  standard_name: surface_backwards_scattering_coefficient_of_radar_wave_normalized_over_water
  suffix: VV
  SourceFilename: /files/normap/ASA_WSM_1PNPDK20060404_091239_000000852046_00308_21404_2157.N1
  pass: 
  minmax: 0 0.1
  SourceBand: 1
  wkv: surface_backwards_scattering_coefficient_of_radar_wave_normalized_over_water
  name: sigma0_water_VV
----------------------------------------
Domain:[5681 x 7560]
----------------------------------------
Projection:
GEOGCS["WGS 84",
    DATUM["WGS_1984",
        SPHEROID["WGS 84",6378137,298.257223563],
        TOWGS84[0,0,0,0,0,0,0]],
    PRIMEM["Greenwich",0],
    UNIT["degree",0.0174532925199433]]
----------------------------------------
Corners (lon, lat):
	 ( 35.09,  73.63)  ( 21.88,  74.89)
	 ( 28.79,  68.89)  ( 18.41,  69.92)


In [4]:
# open local NORMAP SST dataset
n3 = Nansat('/files/normap/20130701000000-METNO-L4_GHRSST-SSTfnd-METNO_OI-ARC-v02.0-fv02.0.nc')
print n3


12:54:10|30|mapper_generic|__init__|Use generic mapper - OK!
WARNING:Nansat:Use generic mapper - OK!
=>METNO Sea Surface Temperature analysis<=
----------------------------------------
/files/normap/20130701000000-METNO-L4_GHRSST-SSTfnd-METNO_OI-ARC-v02.0-fv02.0.nc
----------------------------------------
Mapper: generic
----------------------------------------
Band : 1 analysed_sst
  comment: 
  _FillValue: -32768
  units: kelvin
  scale_factor: 0.0099999998
  name: analysed_sst
  source: OSI-SAF and GHRSST L2P satellite SST products
  dataType: 6
  valid_min: -300
  add_offset: 273.14999
  long_name: analysed sea surface temperature
  standard_name: sea_surface_foundation_temperature
  SourceFilename: NETCDF:"/files/normap/20130701000000-METNO-L4_GHRSST-SSTfnd-METNO_OI-ARC-v02.0-fv02.0.nc":analysed_sst
  NETCDF_DIM_time: 1025481600
  SourceBand: 1
  valid_max: 4500
  wkv: sea_surface_foundation_temperature
Band : 2 analysis_error
  comment: 
  _FillValue: -32768
  units: kelvin
  scale_factor: 0.0099999998
  name: analysis_error
  dataType: 6
  valid_min: 0
  add_offset: 0
  long_name: estimated error standard deviation of analysed_sst
  standard_name: sea_surface_temperature_error
  SourceFilename: NETCDF:"/files/normap/20130701000000-METNO-L4_GHRSST-SSTfnd-METNO_OI-ARC-v02.0-fv02.0.nc":analysis_error
  NETCDF_DIM_time: 1025481600
  SourceBand: 1
  valid_max: 32767
  wkv: sea_surface_temperature_error
Band : 3 mask
  _FillValue: -128
  name: mask
  long_name: land sea ice lake bit mask
  dataType: 1
  flag_masks: {1,2,4,8,16}
  flag_meanings: water land optional_lake_surface sea_ice optional_river_surface
  valid_min: 1
  source: Pathfinder_V5_landmask, EUMETSAT_OSI-SAF_icemask
  SourceFilename: NETCDF:"/files/normap/20130701000000-METNO-L4_GHRSST-SSTfnd-METNO_OI-ARC-v02.0-fv02.0.nc":mask
  NETCDF_DIM_time: 1025481600
  SourceBand: 1
  valid_max: 31
  wkv: 
Band : 4 sea_ice_fraction
  comment: 
  _FillValue: -128
  units: 1
  scale_factor: 0.0099999998
  colormap: jet
  short_name: ice_conc
  source: EUMETSAT_OSI-SAF_icemask
  dataType: 6
  valid_min: 0
  add_offset: 0
  long_name: sea ice area fraction
  standard_name: sea_ice_area_fraction
  SourceFilename: NETCDF:"/files/normap/20130701000000-METNO-L4_GHRSST-SSTfnd-METNO_OI-ARC-v02.0-fv02.0.nc":sea_ice_fraction
  NETCDF_DIM_time: 1025481600
  minmax: 0 100
  SourceBand: 1
  wkv: sea_ice_area_fraction
  valid_max: 100
  name: sea_ice_fraction
----------------------------------------
Domain:[12000 x 867]
----------------------------------------
Projection:
GEOGCS["WGS 84",
    DATUM["WGS_1984",
        SPHEROID["WGS 84",6378137,298.257223563],
        TOWGS84[0,0,0,0,0,0,0]],
    PRIMEM["Greenwich",0],
    UNIT["degree",0.0174532925199433]]
----------------------------------------
Corners (lon, lat):
	 (-180.00,  86.00)  (180.00,  86.00)
	 (-180.00,  59.99)  (180.00,  59.99)


In [5]:
# open remote NORMAP dataset
url = 'http://thredds.nersc.no/thredds/dodsC/normap/arctic12km_seaice/arctic12km_seaice_19870801_19870831.nc'
n4 = Nansat(url)
print n4


WKT: PROJCS["unnamed",GEOGCS["WGS 84",DATUM["unknown",SPHEROID["WGS84",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["degree",0.0174532925199433]],PROJECTION["Polar_Stereographic"],PARAMETER["latitude_of_origin",90],PARAMETER["central_meridian",0],PARAMETER["scale_factor",1],PARAMETER["false_easting",2000000],PARAMETER["false_northing",2000000]]
x/ySize 500 500
(-994000.0, 12000.0, 0, -994000.0, 0, 12000.0)
----------------------------------------
http://thredds.nersc.no/thredds/dodsC/normap/arctic12km_seaice/arctic12km_seaice_19870801_19870831.nc
----------------------------------------
Mapper: opendap
----------------------------------------
Band : 1 TUD000
  _FillValue: -10000
  grid_mapping: polar_stereographic
  colormap: jet
  short_name: ice_conc
  dataType: 3
  valid_min: 0
  name: TUD000
  long_name: Sea Ice Concentration (TUD)
  standard_name: sea_ice_area_fraction
  units: %
  SourceFilename: http://thredds.nersc.no/thredds/dodsC/normap/arctic12km_seaice/arctic12km_seaice_19870801_19870831.nc?TUD.TUD[0][y][x]
  time: 31988.0
  minmax: 0 100
  SourceBand: 1
  wkv: sea_ice_area_fraction
  valid_max: 100
  description: Sea ice algorithm name: TUD
Band : 2 Near90GHz000
  _FillValue: -10000
  grid_mapping: polar_stereographic
  colormap: jet
  short_name: ice_conc
  dataType: 3
  valid_min: 0
  name: Near90GHz000
  long_name: Sea Ice Concentration (Near90GHz)
  standard_name: sea_ice_area_fraction
  units: %
  SourceFilename: http://thredds.nersc.no/thredds/dodsC/normap/arctic12km_seaice/arctic12km_seaice_19870801_19870831.nc?Near90GHz.Near90GHz[0][y][x]
  time: 31988.0
  minmax: 0 100
  SourceBand: 1
  wkv: sea_ice_area_fraction
  valid_max: 100
  description: Sea ice algorithm name: Near90GHz
Band : 3 NORSEX85H000
  _FillValue: -10000
  grid_mapping: polar_stereographic
  colormap: jet
  short_name: ice_conc
  dataType: 3
  valid_min: 0
  name: NORSEX85H000
  long_name: Sea Ice Concentration (NORSEX85H)
  standard_name: sea_ice_area_fraction
  units: %
  SourceFilename: http://thredds.nersc.no/thredds/dodsC/normap/arctic12km_seaice/arctic12km_seaice_19870801_19870831.nc?NORSEX85H.NORSEX85H[0][y][x]
  time: 31988.0
  minmax: 0 100
  SourceBand: 1
  wkv: sea_ice_area_fraction
  valid_max: 100
  description: Sea ice algorithm name: NORSEX85H
Band : 4 ASI000
  _FillValue: -10000
  grid_mapping: polar_stereographic
  colormap: jet
  short_name: ice_conc
  dataType: 3
  valid_min: 0
  name: ASI000
  long_name: Sea Ice Concentration (ASI)
  standard_name: sea_ice_area_fraction
  units: %
  SourceFilename: http://thredds.nersc.no/thredds/dodsC/normap/arctic12km_seaice/arctic12km_seaice_19870801_19870831.nc?ASI.ASI[0][y][x]
  time: 31988.0
  minmax: 0 100
  SourceBand: 1
  wkv: sea_ice_area_fraction
  valid_max: 100
  description: Sea ice algorithm name: ASI
----------------------------------------
Domain:[500 x 500]
----------------------------------------
Projection:
PROJCS["unnamed",
    GEOGCS["WGS 84",
        DATUM["unknown",
            SPHEROID["WGS84",6378137,298.257223563]],
        PRIMEM["Greenwich",0],
        UNIT["degree",0.0174532925199433]],
    PROJECTION["Polar_Stereographic"],
    PARAMETER["latitude_of_origin",90],
    PARAMETER["central_meridian",0],
    PARAMETER["scale_factor",1],
    PARAMETER["false_easting",2000000],
    PARAMETER["false_northing",2000000]]
----------------------------------------
Corners (lon, lat):
	 (-45.00,  53.34)  ( 45.11,  53.28)
	 (-135.11,  53.28)  (135.00,  53.21)

Show map of footprint


In [6]:
n1.write_map('footprint.png', pltshow=True)


Create simple image in full resolution


In [7]:
f = n1.write_figure('gray.jpg', 5, clim='hist', ratio=0.8, logarithm=True, cmapName='gray')
Image('gray.jpg')


Out[7]:

Create RGB image in full resolution


In [8]:
f = n1.write_figure('rgb.jpg', bands=['L_709', 'L_560', 'L_413'], clim='hist', ratio=0.8, logarithm=True)
Image('rgb.jpg')


Out[8]:

Crop MERIS image to a 2000x2000 pixels subset


In [9]:
n1.crop(2000, 5000, 2000, 2000)

# and make an figure of a cropped image
f = n1.write_figure('rgb_cropped.jpg', bands=['L_709', 'L_560', 'L_413'], clim='hist', ratio=0.8, logarithm=True)
Image('rgb_cropped.jpg')


Out[9]:

Define grid of interest (Domain) in cylindrical projection with low resolution


In [3]:
from nansat import Domain

d1 = Domain('+proj=longlat', '-te 21 68 41 74 -tr 0.1 0.1')

d1.write_map('longlat.png', pltshow=True)


Change projection of the MERIS file. Reproject on the lat/lon grid


In [11]:
n1.reproject(d1, 2)


# and make a figure of reprojected dataset
f = n1.write_figure('rgb_longlat.jpg', bands=['L_709', 'L_560', 'L_413'], clim='hist', ratio=0.8, logarithm=True)
Image('rgb_longlat.jpg')


Out[11]:

Define Domain in stereographic projection with high resolution


In [12]:
d2 = Domain('+proj=stere +lon_0=32 +lat_0=71', '-te -200000 -200000 200000 200000 -tr 300 300')


d2.write_map('stere.png', pltshow=True)


Change projection of the MERIS file. Reproject on the stereographic grid.


In [13]:
n1.undo(100)

n1.reproject(d2, 2)


# and make a figure of reprojected dataset
f = n1.write_figure('rgb_stere.jpg',
                    bands=['L_709', 'L_560', 'L_413'],
                    clim='hist',
                    ratio=0.8,
                    logarithm=True)
Image('rgb_stere.jpg')


Out[13]:

Export reprojected data from one band into CF-compliant netCDF file


In [14]:
n1.export('meris_L_413.nc', ['L_413'])
!ncdump -h meris_L_413.nc


netcdf meris_L_413 {
dimensions:
	x = 1333 ;
	y = 1333 ;
variables:
	char stereographic ;
		stereographic:grid_mapping_name = "stereographic" ;
		stereographic:longitude_of_projection_origin = 32. ;
		stereographic:false_easting = 0. ;
		stereographic:false_northing = 0. ;
		stereographic:latitude_of_projection_origin = 71. ;
		stereographic:scale_factor_at_projection_origin = 1. ;
		stereographic:longitude_of_prime_meridian = 0. ;
		stereographic:semi_major_axis = 6378137. ;
		stereographic:inverse_flattening = 298.257223563 ;
		stereographic:spatial_ref = "PROJCS[\"unnamed\",GEOGCS[\"WGS 84\",DATUM[\"unknown\",SPHEROID[\"WGS84\",6378137,298.257223563]],PRIMEM[\"Greenwich\",0],UNIT[\"degree\",0.0174532925199433]],PROJECTION[\"Stereographic\"],PARAMETER[\"latitude_of_origin\",71],PARAMETER[\"central_meridian\",32],PARAMETER[\"scale_factor\",1],PARAMETER[\"false_easting\",0],PARAMETER[\"false_northing\",0]]" ;
		stereographic:GeoTransform = "-200000 300 0 200000 0 -300 " ;
	double x(x) ;
		x:standard_name = "projection_x_coordinate" ;
		x:long_name = "x coordinate of projection" ;
		x:units = "" ;
	double y(y) ;
		y:standard_name = "projection_y_coordinate" ;
		y:long_name = "y coordinate of projection" ;
		y:units = "" ;
	float L_413(y, x) ;
		L_413:long_name = "top of atmosphere emitted toward outer space per unit wavenumber or as a function of wavenumber radiative flux in a particular direction, per unit of solid angle" ;
		L_413:_FillValue = 9.96921e+36f ;
		L_413:colormap = "jet" ;
		L_413:dataType = 6 ;
		L_413:minmax = "0.000 1000" ;
		L_413:name = "L_413" ;
		L_413:short_name = "L" ;
		L_413:SourceBand = 1 ;
		L_413:SourceFilename = "/files/normap/MER_FRS_1PNUPA20110908_092035_000005513106_00223_49806_1826.N1" ;
		L_413:standard_name = "toa_outgoing_spectral_radiance" ;
		L_413:suffix = 413 ;
		L_413:time = "2011-09-08T09:20:35.962775" ;
		L_413:units = "mW m-2 sr-1 (cm-1)-1" ;
		L_413:wavelength = 413 ;
		L_413:wkv = "toa_outgoing_spectral_radiance" ;
		L_413:grid_mapping = "stereographic" ;

// global attributes:
		:GDAL_DS_ATTITUDE_DATA_FILE_NAME = "AUX_ATT_AXVIEC20020924_131534_20020703_120000_20781231_235959" ;
		:GDAL_DS_DIGITAL_ELEVATION_MODEL_FILE_NAME = "AUX_DEM_AXVIEC20031201_000000_20031201_000000_20200101_000000" ;
		:GDAL_DS_DIGITAL_ROUGHNESS_MODEL_FILE_NAME = "MER_DRM_AXVIEC20020122_083343_20020101_000000_20200101_000000" ;
		:GDAL_DS_ECMWF_DATA_FILE_NAME = "AUX_ECA_AXNECM20110908_182709_20110908_090000_20110908_210000" ;
		:GDAL_DS_INSTRUMENT_DATA_FILE_NAME = "MER_INS_AXVIEC20050708_134312_20050101_000000_20150101_000000" ;
		:GDAL_DS_LAND_SEA_MASK_DATA_FILE_NAME = "AUX_LSM_AXVIEC20080218_104630_20020101_000000_20200101_000000" ;
		:GDAL_DS_MERIS_SOURCE_PACKETS_NAME = "MER_FR__0CNPDK20110908_092036_000007573106_00223_49806_3293.N1" ;
		:GDAL_DS_ORBIT_STATE_VECTOR_FILE_NAME = "AUX_FRO_AXVPDS20110912_102114_20110907_221000_20110910_005000" ;
		:GDAL_DS_PROCESSING_PARAMS_L1B_FILE_NAME = "MER_CP1_AXVIEC20050607_065745_20020321_193100_20120321_193100" ;
		:GDAL_DS_RADIOMETRIC_CALIBRATION_FILE_NAME = "MER_RAC_AXVIEC20061009_084736_20061009_220000_20161009_220000" ;
		:GDAL_fileName = "/vsimem/MX6VK5QWK3.vrt" ;
		:GDAL_mapper = "meris_l1" ;
		:GDAL_MPH_ABS_ORBIT = 49806 ;
		:GDAL_MPH_ACQUISITION_STATION = "PDHS-K" ;
		:GDAL_MPH_CLOCK_STEP = -388716790 ;
		:GDAL_MPH_CYCLE = 106 ;
		:GDAL_MPH_DELTA_UT1 = -0.300762 ;
		:GDAL_MPH_LEAP_ERR = 0 ;
		:GDAL_MPH_LEAP_SIGN = 1 ;
		:GDAL_MPH_LEAP_UTC = "01-JAN-2009 00:00:00.000000" ;
		:GDAL_MPH_PHASE = 3 ;
		:GDAL_MPH_PROC_CENTER = "UK-PAC" ;
		:GDAL_MPH_PROC_STAGE = "N" ;
		:GDAL_MPH_PROC_TIME = "18-OCT-2011 21:46:19.000000" ;
		:GDAL_MPH_PRODUCT = "MER_FRS_1PNUPA20110908_092035_000005513106_00223_49806_1826.N1" ;
		:GDAL_MPH_PRODUCT_ERR = 1 ;
		:GDAL_MPH_REF_DOC = "PO-RS-MDA-GS-2009_11_5A" ;
		:GDAL_MPH_REL_ORBIT = 223 ;
		:GDAL_MPH_SAT_BINARY_TIME = -370070528 ;
		:GDAL_MPH_SENSING_START = "08-SEP-2011 09:20:36.779763" ;
		:GDAL_MPH_SENSING_STOP = "08-SEP-2011 09:30:11.514213" ;
		:GDAL_MPH_SOFTWARE_VER = "MERIS/5.06" ;
		:GDAL_MPH_STATE_VECTOR_TIME = "08-SEP-2011 08:55:06.421841" ;
		:GDAL_MPH_UTC_SBT_TIME = "08-SEP-2011 07:39:24.474289" ;
		:GDAL_MPH_VECTOR_SOURCE = "FR" ;
		:GDAL_MPH_X_POSITION = -6809475.949 ;
		:GDAL_MPH_X_VELOCITY = -479.348932 ;
		:GDAL_MPH_Y_POSITION = -2172610.266 ;
		:GDAL_MPH_Y_VELOCITY = 1552.454274 ;
		:GDAL_MPH_Z_POSITION = 6288.009 ;
		:GDAL_MPH_Z_VELOCITY = 7387.530141 ;
		:GDAL_NANSAT_GeoTransform = "(-200000.0| 300.0| 0.0| 200000.0| 0.0| -300.0)" ;
		:GDAL_NANSAT_Projection = "PROJCS[&unnamed&|GEOGCS[&WGS 84&|DATUM[&unknown&|SPHEROID[&WGS84&|6378137|298.257223563]]|PRIMEM[&Greenwich&|0]|UNIT[&degree&|0.0174532925199433]]|PROJECTION[&Stereographic&]|PARAMETER[&latitude_of_origin&|71]|PARAMETER[&central_meridian&|32]|PARAMETER[&scale_factor&|1]|PARAMETER[&false_easting&|0]|PARAMETER[&false_northing&|0]]" ;
		:GDAL_satellite = "ENVISAT" ;
		:GDAL_sensor = "MERIS" ;
		:GDAL_SPH_BAND_WAVELEN = "+0000412691+0000442559+0000489882+0000509819+0000559694+0000619601+0000664573+0000680821+0000708329+0000753371+0000761508+0000778409+0000864876+0000884944+0000900000" ;
		:GDAL_SPH_BANDWIDTH = "+09937+09946+09957+09961+09970+09979+09985+07488+09992+07495+03744+15010+20047+10018+10020" ;
		:GDAL_SPH_COARSE_ERR_FLAG = 0 ;
		:GDAL_SPH_COLUMN_SPACING = 260. ;
		:GDAL_SPH_DATABASE_FLAG = 0 ;
		:GDAL_SPH_ECMWF_TYPE = 1 ;
		:GDAL_SPH_FIRST_FIRST_LAT = 76216087 ;
		:GDAL_SPH_FIRST_FIRST_LONG = 93987141 ;
		:GDAL_SPH_FIRST_LAST_LAT = 86331530 ;
		:GDAL_SPH_FIRST_LAST_LONG = 73304603 ;
		:GDAL_SPH_FIRST_LINE_TIME = "08-SEP-2011 09:20:35.962775" ;
		:GDAL_SPH_FIRST_MID_LAT = 81367431 ;
		:GDAL_SPH_FIRST_MID_LONG = 89651671 ;
		:GDAL_SPH_FORMAT_ERR_FLAG = 1 ;
		:GDAL_SPH_FORMAT_ERR_THRESH = 0. ;
		:GDAL_SPH_INST_FOV = 19159 ;
		:GDAL_SPH_LAST_FIRST_LAT = 52600789 ;
		:GDAL_SPH_LAST_FIRST_LONG = 29263355 ;
		:GDAL_SPH_LAST_LAST_LAT = 55615949 ;
		:GDAL_SPH_LAST_LAST_LONG = 12154514 ;
		:GDAL_SPH_LAST_LINE_TIME = "08-SEP-2011 09:29:47.861143" ;
		:GDAL_SPH_LAST_MID_LAT = 54412743 ;
		:GDAL_SPH_LAST_MID_LONG = 21021653 ;
		:GDAL_SPH_LINE_LENGTH = 4481 ;
		:GDAL_SPH_LINE_TIME_INTERVAL = 43997 ;
		:GDAL_SPH_LINES_PER_TIE_PT = 64 ;
		:GDAL_SPH_NUM_BANDS = 15 ;
		:GDAL_SPH_NUM_FORMAT_ERR = 200416 ;
		:GDAL_SPH_NUM_SLICES = 1 ;
		:GDAL_SPH_NUM_TRANS_ERR = 3 ;
		:GDAL_SPH_OFFSET_COMP = 1 ;
		:GDAL_SPH_PROC_MODE = 1 ;
		:GDAL_SPH_SAMPLES_PER_TIE_PT = 64 ;
		:GDAL_SPH_SLICE_POSITION = 1 ;
		:GDAL_SPH_SPH_DESCRIPTOR = "MER_FRS_1P SPECIFIC HEADER" ;
		:GDAL_SPH_STRIPLINE_CONTINUITY_INDICATOR = 0 ;
		:GDAL_SPH_TRANS_ERR_FLAG = 1 ;
		:GDAL_SPH_TRANS_ERR_THRESH = 0. ;
		:GDAL_start_date = "2011-09-08T09:20:35.962775+00:00" ;
		:GDAL_stop_date = "2011-09-08T09:29:47.861143+00:00" ;
		:Conventions = "CF-1.5" ;
		:GDAL = "GDAL 1.11.1, released 2014/09/24" ;
		:history = "Tue Mar 10 13:00:56 2015: GDAL CreateCopy( meris_L_413.nc, ... )" ;
}

Synergistic processing of various remote sensing data

Collocate datasets


In [23]:
n1 = Nansat('/files/normap/20130701000000-METNO-L4_GHRSST-SSTfnd-METNO_OI-ARC-v02.0-fv02.0.nc')
n2 = Nansat('/files/normap/arctic8km_adt_20130701_20130930.nc')
n3 = Nansat('/files/normap/ice_conc_nh_polstere-100_multi_201307011200.nc')

d = Domain(4326, '-te -12 60 20 81 -tr 0.05 0.05')

n1.reproject(d)
n2.reproject(d)
n3.reproject(d)


sst = n1['analysed_sst']
u = n2['u']
v = n2['v']
ice_conc = n3['ice_conc']

plt.figure(figsize=(15,15))

plt.subplot(131)
plt.imshow(sst, vmin=270, vmax=286)

plt.subplot(132)
plt.imshow(ice_conc, vmin=0, vmax=100)

plt.subplot(133)
plt.imshow(u ** 2 + v ** 2, vmin=0, vmax=.01)


01:05:53|30|mapper_generic|__init__|Use generic mapper - OK!
WARNING:Nansat:Use generic mapper - OK!
=>METNO Sea Surface Temperature analysis<=
=>Arctic Sea Level Absolute Dynamic Topography (ADT)<=
01:05:53|30|mapper_generic|__init__|Use generic mapper - OK!
WARNING:Nansat:Use generic mapper - OK!
01:05:53|30|mapper_generic|__init__|Use generic mapper - OK!
WARNING:Nansat:Use generic mapper - OK!
=>Daily Sea Ice Concentration Analysis from OSI SAF EUMETSAT<=
Out[23]:
<matplotlib.image.AxesImage at 0x7f08fe92cad0>

Mask invalid pixels


In [16]:
# get landmask
watermask = n1.watermask('/files/MOD44W/')[1]

In [24]:
# mask land
sst[watermask == 2] = np.nan
u[watermask == 2] = np.nan
v[watermask == 2] = np.nan
ice_conc[watermask == 2] = np.nan

# mask invalid U and V
u[u<-10] = np.nan
v[v<-10] = np.nan

# mask zero ice concentration
ice_conc[ice_conc <= 0] = np.nan

# mask under-ice currents
u[ice_conc > 0] = np.nan
v[ice_conc > 0] = np.nan

# mask invalid SST
sst[sst < 0] = np.nan

plt.figure(figsize=(15,15))
plt.subplot(131)
plt.imshow(sst, vmin=270, vmax=286)
plt.subplot(132)
plt.imshow(ice_conc, vmin=0, vmax=100)
plt.subplot(133)
plt.imshow(np.hypot(u, v), vmin=0, vmax=.1)


Out[24]:
<matplotlib.image.AxesImage at 0x7f08fe697650>

Create a map with collocated datasets


In [26]:
from nansat import Nansatmap

nmap = Nansatmap(n3, resolution='l')
nmap.pcolormesh(sst-273.15, vmin=-5, vmax=13)
nmap.pcolormesh(ice_conc, cmap='bone')

nmap.quiver(u, v, step=7, scale=4, width=0.001)
nmap.draw_continents()
nmap.drawmeridians(np.arange(-12, 20, 5), labels=[False,False,True,False])
nmap.drawparallels(np.arange(60, 81, 3), labels=[True, False, False, False])

# set size of the figure (inches)
nmap.fig.set_figheight(20)
nmap.fig.set_figwidth(15)

# save figure to a PNG file
nmap.save('normap_map.png')


Collocated data on a transect


In [20]:
# open files
n1 = Nansat('/files/normap/20130701000000-METNO-L4_GHRSST-SSTfnd-METNO_OI-ARC-v02.0-fv02.0.nc')
n2 = Nansat('/files/normap/arctic8km_adt_20130701_20130930.nc')

# define start and end of transects
points = [[(4, 62), (-8, 73)]]

# extract transects
values1, lonlat1, pixlin1 = n1.get_transect(points)
values2, lonlat2, pixlin2 = n2.get_transect(points)


# plot
sst = values1['1:analysed_sst']['shape0']
lat1 = lonlat1['shape0']['latitude']

v = values2['1:v']['shape0']
lat2 = lonlat2['shape0']['latitude']
fig, ax1 = plt.subplots(figsize=(10,10))

ax1.plot(lat1, sst, '.-k', label='SST')
ax1.set_ylabel('SST, K')
ax1.legend(loc=1)

ax2 = ax1.twinx()
ax2.plot(lat2, v, 'o-', label='V')
ax2.set_ylim([-.1, .1])
ax2.set_ylabel('V, m/s')
ax2.legend(loc=3)
plt.show()


01:02:20|30|mapper_generic|__init__|Use generic mapper - OK!
WARNING:Nansat:Use generic mapper - OK!
=>METNO Sea Surface Temperature analysis<=
=>Arctic Sea Level Absolute Dynamic Topography (ADT)<=
01:02:20|30|mapper_generic|__init__|Use generic mapper - OK!
WARNING:Nansat:Use generic mapper - OK!

Analyze time-series


In [21]:
import glob
from dateutil.parser import parse

# define start and end of transects
points = [(4, 62)]

# list files in time series
adtFiles = sorted(glob.glob('/files/normap/arctic8km_adt*'))

speeds = []
dates = []
# loop through files
for adtFile in adtFiles:
    # open file with nansat
    n = Nansat(adtFile)
    # fetch data from transect
    values, lonlat, pixlin = n.get_transect(points, bandList=[1,2])
    v = values['1:v']['shape0']
    u = values['2:u']['shape0']
    # add data for hovmoller plot
    speeds.append(np.hypot(u, v)[0])
    # get time
    dates.append(parse(n.get_metadata('time_coverage_start')))
    
    
    
# create Hovmoller plot
fig = plt.figure(figsize=(10,10))
plt.plot(dates, speeds, 'o-')
plt.xlabel('Date')
plt.ylabel('Geostrophic current speed at 4oE 62oN')


01:02:30|30|mapper_generic|__init__|Use generic mapper - OK!
WARNING:Nansat:Use generic mapper - OK!
=>Arctic Sea Level Absolute Dynamic Topography (ADT)<=
=>Arctic Sea Level Absolute Dynamic Topography (ADT)<=
01:02:31|30|mapper_generic|__init__|Use generic mapper - OK!
WARNING:Nansat:Use generic mapper - OK!
=>Arctic Sea Level Absolute Dynamic Topography (ADT)<=
01:02:31|30|mapper_generic|__init__|Use generic mapper - OK!
WARNING:Nansat:Use generic mapper - OK!
=>Arctic Sea Level Absolute Dynamic Topography (ADT)<=
01:02:31|30|mapper_generic|__init__|Use generic mapper - OK!
WARNING:Nansat:Use generic mapper - OK!
=>Arctic Sea Level Absolute Dynamic Topography (ADT)<=
01:02:31|30|mapper_generic|__init__|Use generic mapper - OK!
WARNING:Nansat:Use generic mapper - OK!
=>Arctic Sea Level Absolute Dynamic Topography (ADT)<=
01:02:31|30|mapper_generic|__init__|Use generic mapper - OK!
WARNING:Nansat:Use generic mapper - OK!
=>Arctic Sea Level Absolute Dynamic Topography (ADT)<=
01:02:31|30|mapper_generic|__init__|Use generic mapper - OK!
WARNING:Nansat:Use generic mapper - OK!
=>Arctic Sea Level Absolute Dynamic Topography (ADT)<=
01:02:32|30|mapper_generic|__init__|Use generic mapper - OK!
WARNING:Nansat:Use generic mapper - OK!

Out[21]:
<matplotlib.text.Text at 0x7f08fef32fd0>

Colocate local NORMAP and remote GLOBCURRENT data


In [ ]:
nn = Nansat('http://www.ifremer.fr/opendap/cerdap1/globcurrent/global_010_deg/total_hs/2012/183/20120701000000-GLOBCURRENT-L4-CUR-ALT-total_hs-v01.0-fv01.0.nc')


WKT: 
x/ySize 3600 1600
(-179.95, 0.099990845, 0, -79.949997, 0, 0.099998474)

In [28]:
print nn


----------------------------------------
http://www.ifremer.fr/opendap/cerdap1/globcurrent/global_010_deg/total_hs/2012/183/20120701000000-GLOBCURRENT-L4-CUR-ALT-total_hs-v01.0-fv01.0.nc
----------------------------------------
Mapper: opendap
----------------------------------------
Band : 1 eastward_total_current_velocity_hs000
  _FillValue: -2147483647.0
  grid_mapping: crs
  name: eastward_total_current_velocity_hs000
  long_name: Absolute geostrophic velocity + Hs depth Ekman velocity: zonal component
  dataType: 7
  units: m/s
  source: GlobCurrent
  SourceFilename: http://www.ifremer.fr/opendap/cerdap1/globcurrent/global_010_deg/total_hs/2012/183/20120701000000-GLOBCURRENT-L4-CUR-ALT-total_hs-v01.0-fv01.0.nc?eastward_total_current_velocity_hs.eastward_total_current_velocity_hs[0][y][x]
  time: 22827.0
  SourceBand: 1
Band : 2 northward_total_current_velocity_hs000
  _FillValue: -2147483647.0
  grid_mapping: crs
  name: northward_total_current_velocity_hs000
  long_name: Absolute geostrophic velocity + Hs depth Ekman velocity: meridian component
  dataType: 7
  units: m/s
  source: GlobCurrent
  SourceFilename: http://www.ifremer.fr/opendap/cerdap1/globcurrent/global_010_deg/total_hs/2012/183/20120701000000-GLOBCURRENT-L4-CUR-ALT-total_hs-v01.0-fv01.0.nc?northward_total_current_velocity_hs.northward_total_current_velocity_hs[0][y][x]
  time: 22827.0
  SourceBand: 1
----------------------------------------
Domain:[3600 x 1600]
----------------------------------------
Projection:
GEOGCS["WGS 84",
    DATUM["WGS_1984",
        SPHEROID["WGS 84",6378137,298.257223563],
        TOWGS84[0,0,0,0,0,0,0]],
    PRIMEM["Greenwich",0],
    UNIT["degree",0.0174532925199433]]
----------------------------------------
Corners (lon, lat):
	 (-179.95, -79.95)  (180.02, -79.95)
	 (-179.95,  80.05)  (180.02,  80.05)

Fet data from remote GLOBCURRENT dataset


In [30]:
nn.reproject(d)
u = nn['eastward_total_current_velocity_hs000']
v = nn['northward_total_current_velocity_hs000']
lons, lats = nn.get_geolocation_grids()

Create map of NORMAP and (yet) external data


In [2]:
%matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
from IPython.display import Image
from nansat import Nansat, Domain, Nansatmap

n1 = Nansat('/files/normap/20130701000000-METNO-L4_GHRSST-SSTfnd-METNO_OI-ARC-v02.0-fv02.0.nc')
n3 = Nansat('/files/normap/ice_conc_nh_polstere-100_multi_201307011200.nc')

d = Domain(4326, '-te -12 60 20 81 -tr 0.05 0.05')

n1.reproject(d)
n3.reproject(d)


sst = n1['analysed_sst']
ice_conc = n3['ice_conc']

# mask land
watermask = n1.watermask('/files/MOD44W/')[1]
sst[watermask == 2] = np.nan
u[watermask == 2] = np.nan
v[watermask == 2] = np.nan
ice_conc[watermask == 2] = np.nan

# mask invalid U and V
u[u<-10] = np.nan
v[v<-10] = np.nan

# mask zero ice concentration
ice_conc[ice_conc <= 0] = np.nan

# mask under-ice currents
u[ice_conc > 0] = np.nan
v[ice_conc > 0] = np.nan

# mask invalid SST
sst[sst < 0] = np.nan

nmap = Nansatmap(n3, resolution='l')
nmap.pcolormesh(sst-273.15, vmin=-5, vmax=13)
nmap.pcolormesh(ice_conc, cmap='bone')

nmap.streamplot(lons, lats, u, v, density=5, linewidth=np.hypot(u,v)*10, color='k')

nmap.draw_continents()
nmap.drawmeridians(np.arange(-12, 20, 5), labels=[False,False,True,False])
nmap.drawparallels(np.arange(60, 81, 3), labels=[True, False, False, False])

# set size of the figure (inches)
nmap.fig.set_figheight(20)
nmap.fig.set_figwidth(15)

# save figure to a PNG file
nmap.save('normap_globcurrent_map.png')


10:02:07|30|mapper_generic|__init__|Use generic mapper - OK!
WARNING:Nansat:Use generic mapper - OK!
=>METNO Sea Surface Temperature analysis<=
=>Daily Sea Ice Concentration Analysis from OSI SAF EUMETSAT<=
10:02:07|30|mapper_generic|__init__|Use generic mapper - OK!
WARNING:Nansat:Use generic mapper - OK!

---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-2-96b79a335ea8> in <module>()
     20 watermask = n1.watermask('/files/MOD44W/')[1]
     21 sst[watermask == 2] = np.nan
---> 22 u[watermask == 2] = np.nan
     23 v[watermask == 2] = np.nan
     24 ice_conc[watermask == 2] = np.nan

NameError: name 'u' is not defined

In [ ]: